"""
光纤生产产线看板系统配置文件
"""

import os

class Config:
    """基础配置类"""
    
    # 服务器配置
    HOST = '0.0.0.0'
    PORT = 19000
    DEBUG = True
    
    # 数据库配置（预留）
    DATABASE_URL = os.environ.get('DATABASE_URL', 'sqlite:///kanban.db')
    
    # 跨域配置
    CORS_ORIGINS = ['http://localhost:3000', 'http://localhost:19000']
    
    # 数据刷新间隔（秒）
    REFRESH_INTERVAL = 30
    
    # 模拟数据配置
    MOCK_DATA = {
        'factories': ['factory1', 'factory2', 'factory3'],
        'workshops': ['workshop1', 'workshop2', 'workshop3'],
        'lines': ['line1', 'line2', 'line3'],
        'statuses': ['running', 'completed', 'paused'],
        'processes': ['剥纤', '干涉', '端检', '插回损', '极性']
    }
    
    # 品质等级配置
    QUALITY_LEVELS = {
        'excellent': {'min': 99.0, 'color': 'quality-excellent'},
        'good': {'min': 98.0, 'color': 'quality-good'},
        'warning': {'min': 95.0, 'color': 'quality-warning'},
        'poor': {'min': 0.0, 'color': 'quality-poor'}
    }
    
    # 环境参数范围
    ENVIRONMENT_RANGES = {
        'temperature': {'min': 20, 'max': 25, 'unit': '°C'},
        'humidity': {'min': 40, 'max': 50, 'unit': '%'}
    }

class DevelopmentConfig(Config):
    """开发环境配置"""
    DEBUG = True
    CORS_ORIGINS = ['http://localhost:3000', 'http://localhost:19000', 'http://127.0.0.1:19000']

class ProductionConfig(Config):
    """生产环境配置"""
    DEBUG = False
    HOST = '0.0.0.0'
    PORT = 19000
    CORS_ORIGINS = ['https://yourdomain.com']

class TestingConfig(Config):
    """测试环境配置"""
    TESTING = True
    DEBUG = True
    DATABASE_URL = 'sqlite:///:memory:'

# 配置映射
config = {
    'development': DevelopmentConfig,
    'production': ProductionConfig,
    'testing': TestingConfig,
    'default': DevelopmentConfig
}
